package swing.renderer;

import java.lang.reflect.Field;

import annotations.Param;

public class RendererFactory {
	public static Renderer createRenderer (Field field, Param p, Class<?> type, Object initialValue){
		
		if (type==int.class){
			if (p.percentage()==true){
				
				SliderRenderer renderer = new SliderRenderer(field, p.name(), p.description(), "", initialValue);
				return renderer;
				
				
			} else {
				
				IntegerRenderer renderer = new IntegerRenderer(field, p.name(), p.description(), "", initialValue);
				return renderer;
				
			}
		} else if (type==String.class){

			StringRenderer renderer = new StringRenderer(field, p.name(), p.description(), "", initialValue);
			return renderer;
		
		
		} else if (type==boolean.class){
			
			BooleanRenderer renderer = new BooleanRenderer(field, p.name(), p.description(), "", initialValue);
			return renderer;
			
		} else {
			StringRenderer renderer = new StringRenderer(field, p.name(), p.description(), "", initialValue);
			return renderer;
		}
		
	}

}
